package cqut.wys.controller;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * --------神兽出没--------/
 * ┌─┐     ┌─┐
 * ┌─┘─┴─────┘─┴─┐
 * │      ─      │
 * │  ┬─┘   └─┬  │
 * │             │
 * │      ┴      │  Code is far away from bug with the animal protecting
 * └───┐      ┌──┘  神兽保佑,代码无bug
 * │      │
 * │      └──────┐
 * │             ├┐
 * │             ┌┘
 * └┐ ┐ ┌───┬─┐ ┌┘
 * │ ┤ ┤   │ ┤ ┤
 * └─┴─┘   └─┴─┘
 * --------感觉萌萌哒--------/
 *
 * @author wuyoushan
 * @date 2018/6/10
 */
@RestController
@RequestMapping("/service2")
public class ZipkinBraveController {

    @Autowired
    private OkHttpClient client;

    @RequestMapping("/test")
    public String service1() throws Exception {
        Thread.sleep(200);
        Request request3 = new Request.Builder().url("http://localhost:8083/service3/test").build();
        Response response3 = client.newCall(request3).execute();

        Request request4 = new Request.Builder().url("http://localhost:8084/service4/test").build();
        Response response4 = client.newCall(request4).execute();
        return response3.toString()+":"+response4.toString();
    }
}
